package options

import (
	"time"

	"gitee.com/sdxstar/air/codec"
	"gitee.com/sdxstar/air/logger"
	"gitee.com/sdxstar/air/protocol"
)

type ServerOptions struct {
	// common
	WorkId                 uint16
	Address                string
	PacketSendChanLimit    uint32
	PacketReceiveChanLimit uint32
	MessageTimeout         time.Duration
	Codec                  codec.Codec
	Protocol               protocol.Protocol
	Logger                 logger.Logger

	// only for server
	HeartbeatTimeout time.Duration
}

func DefaultServerOptions() *ServerOptions {
	return &ServerOptions{
		// common
		WorkId:                 1,
		Address:                ":1200",
		MessageTimeout:         5 * time.Second,
		PacketSendChanLimit:    1,
		PacketReceiveChanLimit: 1,
		Codec:                  codec.NewDefaultCodec(),
		Protocol:               protocol.NewDefaultProtocol(),

		// only for server
		HeartbeatTimeout: 40 * time.Second,
	}
}
